products = [["iphone",6888],["MacPro",14800],["小米6",2499],["Coffee",31],["Book",60],["Nike",699]]
print("-"*6,"商品列表","-"*6)
for item in products:
    print(*item,sep="\t")
shop_cost = dict(products)
shop_car= {}
while True:
    cmd = input("请输入需要加入购物车的商品：").replace(",","").strip()  #todo 增加个退出程序的提示
    if cmd =="q":
        break
    if cmd not in shop_cost.keys():
        print("输入错误请重新输入")
        continue
    shop_car[cmd]=shop_car.get(cmd,0)+1

for k,v in shop_car.items():
    print("{}{}个   共计费用{}".format(k,v,shop_cost[k]*v))

# 缺少个买后如何退出的提示，以及购买成功的提示